define(function(require, exports, module) {
	require('jquery');
	require('config');
	require('bootstrap');
	require('easing');
	require('fancybox');
	require('jcookie');
    require('jquerytmpl');

	//基础格式判断
	$.extend({
		testAct: function(str,reg){
			return(reg.test(str));
		},
		testBasic: function(str){
			var bl = str ? true : false;
			return(bl);
		},
		testMail: function(str){
			var myReg = /^[.-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;
			return($.testAct(str,myReg));
		},
		testPass: function(str){
			var myReg = /^[a-z0-9_-]{3,18}$/;
			return($.testAct(str,myReg));
		},
		testIP: function(str){
			var myReg = /((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)/;
			return($.testAct(str,myReg));
		},
		testChinaName: function(str){
			var myReg = /^[\u2E80-\u9FFF]+$/;
			return($.testAct(str,myReg));
		},
		testNumber: function(str){
			var myReg = /^[0-9]/;
			return($.testAct(str,myReg));
		},
		testMobile: function(str){
			var myReg = /^(1(([35][0-9])|(47)|[8][0123456789]))\d{8}$/;
			return($.testAct(str,myReg));
		},
		testPhone: function(str){
			var myReg = /^\d{10,12}$/;
			return($.testAct(str,myReg));
		},
		QueryString: function(str){
			var sValue=location.search.match(new RegExp("[\?\&]"+str+"=([^\&]*)(\&?)","i"));
			return sValue?sValue[1]:sValue;
		},
		randomNumber: function(){ //四位随机数或者字母
			function only(ele,arr){
				if(arr.length==0){
					return true;
				}
				for(var j=0;j<arr.length;j++){
					if(ele==arr[j]){
						return false;
					}else{
						return true;
					}
				}
			}
			var arr=[0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f","g"];
			var str="";
			(function(){
				var randNum=null;
				var old=[];
				function done(){
					randNum=Math.floor(Math.random()*14);
					if(only(randNum,old)){
						str=str+arr[randNum];
						old.push(randNum);
					}else{
						done();
					}
				}
				for(var index=0;index<4;index++){
					done();
				};
			})(arr);
			return str;
		},
		/**
		 * 创建出翻页的html代码 
		 * @param  {[string]} a [目前数据总的页数]
		 * @param  {[string]} b [一页显示的数目，默认值是10]
		 * @return {[jqobj]}   [<ul><li>...</li></ul>]
		 */
		creatNav: function(a,b){
			var all = Number(a),
				intverval = b ? Number(b) : 10,
				pageNum = Math.ceil(all/intverval);
			var obj = {li_arr:[]};
			obj.pageNum = pageNum;
			obj.ul = $('<ul class="pager clearfix"></ul>');
			obj.prev = $('<li class="item prev"><a aria-label="Previous"><span aria-hidden="true">Prev</span></a></li>').appendTo(obj.ul);
			obj.next = $('<li class="item next"><a aria-label="Next"><span aria-hidden="true">Next</span></a></li>').appendTo(obj.ul);
			obj.text = $('<li class="item text"><input type="text" class="form_text" value="1" /><a class="target_button"><span>跳转</span></a></li>').appendTo(obj.ul);
			obj.dis = $('<li class="item dis">共<b>'+pageNum+'</b>页</li>').appendTo(obj.ul);
			return obj;
		},
		dateFormat: function (date,fmt) { //author: meizz 
		    var o = {
		        "M+": date.getMonth() + 1, //月份 
		        "d+": date.getDate(), //日 
		        "h+": date.getHours(), //小时 
		        "m+": date.getMinutes(), //分 
		        "s+": date.getSeconds(), //秒 
		        "q+": Math.floor((date.getMonth() + 3) / 3), //季度 
		        "S": date.getMilliseconds() //毫秒 
		    };
		    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
		    for (var k in o)
		    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
		    return fmt;
		}
	});
});

